<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>

<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>


<div id="Page-content">
	<s:if test="%{#request.lstCart.size < 1}">
		<div style="font-size: 20px; font-weight: bold; margin: 20px">
		 	No exist cart
		 </div>
	</s:if>
	<s:else>
		<div class="page-compare" style="padding-top: 5px; width:659px; text-align: center; margin-left:20px">
		<form name="frmSort" action="<s:url action="user/info" namespace="/" />" method="get" style="float: right">

			<label for="sort">Sort by:</label>
			<input type="hidden" name="action" value="viewcart" />
			<s:select name="sortby"
				list="#{'1':'Date latest', '2':'Total price hight to low', '3':'Total price low to hight'}"
				value="#request.sortby" onchange="submit()" />
		</form>
	</div>
		<table style="text-align: center; margin: 20px; width:659px">
			<tr>
				<th style="text-align: center; font-size: 20px; font-weight: bold">N.Order</th>
				<th style="text-align: center; font-size: 20px; font-weight: bold">Date</th>
				<th style="text-align: center; font-size: 20px; font-weight: bold">Price</th>
				<th style="text-align: center; font-size: 20px; font-weight: bold">Status</th>
				<th ></th>
			</tr>
			
			<s:iterator status="cart" value="#request.lstCart">
				<tr >
					<td style="text-align: center; font-size: 12px; font-weight: bold">
						<s:property value="#cart.index+1" />
					</td>
					
					<td style="text-align: center; font-size: 12px; font-weight: bold">
						<s:property value="date" />
					</td>
					
					<td style="text-align: center; font-size: 12px; font-weight: bold">
						<s:property value="totalPrice" /> $
					</td>
					
					<td style="text-align: center; font-size: 12px; font-weight: bold">
						<s:property value="status" />
					</td>
					
					<td>
						<div class="button" style="margin:20px; text-align: center;">
							<a href="<s:url action="user/info" namespace="/"><s:param name="action" >viewcartdetail</s:param><s:param name="idCart" value="idcart" /></s:url>">Details</a>
						</div>
					</td>
				</tr>
			</s:iterator>
			
		</table>
	</s:else>
</div>
